const express = require('express');
const router = express.Router();
const messageController = require('../controllers/messageController');
const authMiddleware = require('../middlewares/auth');

// 发送消息（需要认证+文件上传中间件）
router.post('/',
  authMiddleware.authenticate,
  messageController.uploadFile,
  messageController.sendMessage
);

// 获取消息列表（需要认证）
router.get('/:roomId',
  authMiddleware.authenticate,
  messageController.getMessages
);

// 删除消息（需要认证）
router.delete('/:id',
  authMiddleware.authenticate,
  messageController.deleteMessage
);

module.exports = router;